#pragma once
#include <deque>
#include <fstream>

enum BusStatus
{
	InDRFrame,	//in Data or Remote Frame
	InErrorFrame,
	InOverloadFrame,
	Intermission,
	SuspendTransmission,
	Idle,
	Wrong, //indicates that Bus is malfunctioning
	Any //means any status
};

class Bus
{
private:
	bool mCurBit;
	std::deque<bool> mOldBits;
	BusStatus mCurStatus;
	std::deque<BusStatus> mOldStatuses;
public:
	Bus();
	~Bus();
	bool getPrvBit();
	bool getCurBit();
	void trySetCurBit(bool);
	bool isIdle();
	BusStatus getPrvStatus();
	BusStatus getCurStatus();
	void setCurStatus(BusStatus);
	void run();
};